import React, { useContext } from 'react';
import Actions from './Actions';
import { useToolbar } from '../../hooks';
import '../../style.less';
import { InBizTableCtx } from '../../context';

const Toolbar = () => {
  const {topBtnMorePopover, buttonPosition} = useContext(InBizTableCtx)
  const toolbar = useToolbar();

  return toolbar ? (
    <div className={topBtnMorePopover ? `tableTopBtnGroupToolbar ${buttonPosition == 'right' ? 'right' : 'left'}` : ''}>
      <Actions {...toolbar} topBtnMorePopover={topBtnMorePopover} buttonPosition={buttonPosition} />
    </div>
  ) : null;
};

export default React.memo(Toolbar);
